// Copyright 2022 jeff.li. and/or its affiliates.

#pragma once

#include <vector>
#include "i_runnable.h"

namespace tbir::runtime::internal {

    struct IThreadPool {
        virtual ~IThreadPool() = default;

        virtual void Enqueue(IRunnablePtr &runner, size_t seq) = 0;

        virtual void EnqueueBulk(std::vector<IRunnablePtr> &runners) {
            for (size_t i = 0; i < runners.size(); ++i) {
                Enqueue(runners[i], i);
            }
        }

        virtual size_t GetThreadsNum() const = 0;

        virtual std::vector<std::thread::id> GetThreadIds() const = 0;

        static void WaitBulk(std::vector<IRunnablePtr> &runners);
    };

}  // namespace tbir::runtime::internal
